#if !defined(__APP_SERIAL_H)
#define __APP_SERIAL_H
#include <termios.h>
#include "app_device.h"

typedef enum
{
    BR_9600 = B9600,
    BR_115200 = B115200,
} BaudRate_t;

typedef enum
{
    Parity_NONE = 0,
    Parity_ODD = PARENB | PARODD,
    Parity_EVEN = PARENB,
} Parity_t;

typedef enum
{
    SB_1 = 0,   //1位
    SB_2 = CSTOPB,  //2位
} StopBits_t;

/// @brief
/// @return
int app_serial_init(Device *device);

int app_serial_setBaudRate(Device *device, BaudRate_t baudrate);

int app_serial_setParity(Device *device, Parity_t parity);

int app_serial_setStopBits(Device *device, StopBits_t stopbits);

int app_serial_setBlock(Device *device, int is_block);

int app_serial_setRaw(Device *device);


#endif // __APP_SERIAL_H



